package com.ggh.jinjilive.ui.mine.family;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.ggh.jinjilive.R;
import com.ggh.jinjilive.databinding.FragmentTaskReceiveBinding;
import com.ggh.jinjilive.listener.AddItemOnClickListener;
import com.ggh.jinjilive.ui.BaseFragment;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;


import org.jetbrains.annotations.NotNull;

public class RankingListFragment extends BaseFragment<FragmentTaskReceiveBinding> implements OnRefreshListener, OnLoadMoreListener {
    private int page = 1;
    //搜索内容
    private String search = "";


    private int type;
    public RankingListFragment(int type){

        this.type = type;
    }

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        return R.layout.fragment_task_receive;
    }

    @Override
    public void initView() {
        super.initView();
        //自动刷新
        binding.refreshLayout.autoRefresh();

    }

    @Override
    public void initData() {
        super.initData();

    }

    public void setSearch(String search){
        this.search = search;
        //自动刷新
        binding.refreshLayout.autoRefresh();
    }



    @Override
    public void initViewObservable() {
        super.initViewObservable();
        //刷新
        binding.refreshLayout.setOnRefreshListener(this);
        //加载
        binding.refreshLayout.setOnLoadMoreListener(this);
    }

    @Override
    public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
        page = page + 1;
    }

    @Override
    public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
        page = 1;

    }


}
